package com.lc202406;

public class Solution242 {
    public boolean isAnagram(String s, String t) {
        int length = s.length();
        if (t.length() != length) {
            return false;
        }
        int[] cnt = new int[26];
        for (int i = 0; i < length; i++) {
            cnt[s.charAt(i)-'a']++;
            cnt[t.charAt(i)-'a']--;
        }
        for (int i : cnt) {
            if (i != 0) {
                return false;
            }
        }
        return true;
    }
}
